#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QGLWidget>
#include <QMouseEvent>
#include <QKeyEvent>
#include <QFileDialog>
#include <QTimer>
#include "point.h"
#include "scene.h"

class GLWidget : public QGLWidget
{
    Q_OBJECT

public:
    GLWidget(QWidget *parent = 0);

protected:
    void initializeGL ();
    void paintGL ();
    void resizeGL (int width, int height);

    virtual void mousePressEvent (QMouseEvent *e);
    virtual void mouseReleaseEvent (QMouseEvent *e);
    virtual void mouseMoveEvent (QMouseEvent *e);
    virtual void keyPressEvent (QKeyEvent *event);

    Scene scene;

    typedef  enum {NONE, ROTATE, ZOOM, PAN} InteractiveAction;
    InteractiveAction DoingInteractive;

    int   xClick, yClick;

  public slots:
    void CarregaPersonatge ();
    void ResetCamera();
    void CarregaAntagonista();
    void MoureEnemics();
    void StartGame();
    void PauseGame();
    void Dificultat(int);
    void NEnemies(int);
    void NRows(int);
    void NColumns(int);
    private:
        Point VRP;
        float r;
        double d, panX, panY, angleX, angleY, fovy, ar, zN, zF, pi, psi, thita;
        QTimer timer;
        void updateCamera();
        int engine;
};

#endif
